<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return=array();
	exi($return);
}
//解析地址
if($_RQ['op']=='jieaddress'){
	$post=get_postdata();
	if(!$post['apiaddress']){
		exi('请输入要解析的地址','error');
	}
	$res=$this->model('api')->getaddress($post['apiaddress']);
	if($res['city']=='北京市' || $res['city']=='上海市' || $res['city']=='天津市' || $res['city']=='重庆市'){
		//最新的地址不需要了
		//$res['city']='市辖区';
	}
	$jieaddress=array(
		'name'=>$res['person'],
		'mobile'=>$res['phonenum'],
		'pcd'=>array(
			'province'=>$res['province'],
			'city'=>$res['city'],
			'district'=>$res['county'],
			'street'=>$res['town'],
		),
		'lat_lng'=>array('lat'=>$res['lat'],'lng'=>$res['lng']),
		'address'=>$res['detail'],
	);
	$return['jieaddress']=$jieaddress;
	exi($return);
}
?>